/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package swa.e_store.businessLogic;

import swa.e_store.entity.Employee;
import swa.e_store.DTO.*;
import swa.e_store.ENUM.EmployeeState;

/**
 * Class dtoFactory is used by the Remote-Facade class "BL_RemoteFascade" for
 * creating and filling their DTOs, needed for communication between
 * presentation and application layer.
 * 
 * @author Stefan
 */
public class BL_dtoFactory {

    public AuthenticationDTO createAuthenticationDTO(Employee employeeDataObject) {
        
        AuthenticationDTO authDTO = new AuthenticationDTO();
        authDTO.setEmployeeState(intToEmployeeState(employeeDataObject.getEmployeeState()));
        
        return authDTO;
    }
    
    

    // Hack for Method createAuthenticationDTO to convert int to Enum.
    private EmployeeState intToEmployeeState(int value){
        switch(value){
            
            case 0:
                return EmployeeState.NONE;
            case 1:
                return EmployeeState.SYSADMIN;
            case 2:
                return EmployeeState.BRANCHMNGR;
            case 3:
                return EmployeeState.ASSISTANT;
            default: return EmployeeState.NONE;
        }
    }
}
